package com.eks.websocket.client.sender;

import lombok.extern.slf4j.Slf4j;
import org.java_websocket.client.WebSocketClient;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import java.net.URI;
import java.net.URISyntaxException;

@Slf4j
@Component
public class ClientSender {

    @Bean
    public WebSocketClient webSocketClient() throws URISyntaxException {
        log.info("new MyWebSocketClient");
        WebSocketClient client = new MyWebSocketClient(new URI("ws://localhost:6020/msg"));
        client.connect();
        return client;
    }
}
